package com.cy.pj.module.controller;

import com.cy.pj.module.pojo.RequestParameter;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author Cx
 * @stage secondStageOfWeb
 * @creat 2020-11-04 17:15
 */
@RestController
public class ParamObjectController {

    @GetMapping("/doParam01")
    public String doMethodParam(String name) {
        return "request params " + name;
    }

    @GetMapping("/doParam02")
    public String doMethodParam(RequestParameter param) {
        //pojo对象接收请求参数,pojo对象中需提供与参数名相匹配的set方法
        return "request params " + param.toString();
    }

    @GetMapping("/doParam03")
    public String doMethodParam(@RequestParam Map<String,Object> param){
        return "request params "+param.toString();
    }

}
